package edu.hunau.cxb19.oop.class32.tcp.v2;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;

/**
 *
 *@author hb
 *
 * 2020-04-21 15:59:45
 */
public class ServerTcp {

	public static void main(String[] args) throws Exception {
		ServerSocket server = new ServerSocket(8088);
		System.out.println("服务端启动");
		Socket socket = server.accept();
		System.out.println("和客户端连接成功....");
		//获得输入流:读取内容
		InputStream is = socket.getInputStream();
		InputStreamReader isr = new InputStreamReader(is);
		BufferedReader br = new BufferedReader(isr);
		String datas = br.readLine();
		System.out.println(datas);
		br.close();
		server.close();
	}
}
